<template>
	<view>
		<!--提交异常反馈-->
		<block  v-if="is_yichangForm==true&&loading==true">
			<yichangForm :order="order" @change="yichang_tab" :jindu="jindu"></yichangForm>
		</block>
	
		<!--发布者等待处理-->
		<waitHandle  @change="yichang_tab"  v-if="is_waitHandle==true&&loading==true&&loading2==true" :order="order" :Record2="record"
		:customStyle1="customStyle1" :customStyle11="customStyle11"
		:customStyle2="customStyle2" :customStyle3="customStyle3"
		>
		</waitHandle>
	
	</view>
</template>

<script>
	import {HTTP_REQUEST_URL,HTTP_IMG_UTL,IMAGE_URL} from "@/config/app";
	import yichangForm from "./abnormal/yichangForm.vue"
	import waitHandle from "./abnormal/waitHandle.vue"
	
	export default {
		components: {
			yichangForm,waitHandle
		},
		data() {
			return {
				//远程域名
				HTTP_IMG_UTL,
				HTTP_REQUEST_URL,
				IMAGE_URL,
				url: IMAGE_URL,
				
				//语言
				lang: this.$i18n.locale,
				//文字
				text:{			
					xieyi:this.$t('异常反馈')
				},
				//订单详情
				order:{},
				record:{},
				
				customStyle1: {
					width: '240rpx',
					height: '83rpx',
					marginTop:'20rpx',
					fontSize:'24rpx',
					background: '#008aff',
					borderRadius: '56rpx'
				},
				customStyle11: {
					width: '240rpx',
					height: '83rpx',
					marginTop:'20rpx',
					fontSize:'24rpx',
					background: '#ff2323',
					borderRadius: '56rpx'
				},
				customStyle2: {
					width: '500rpx',
					height: '83rpx',
					marginTop:'20rpx',
					fontSize:'24rpx',
					background: '#ff2323',
					borderRadius: '56rpx'
				},
				customStyle3: {
					width: '240rpx',
					height: '83rpx',
					marginTop:'20rpx',
					fontSize:'24rpx',
					background: 'gray',
					borderRadius: '56rpx'
				},
				
				is_list:0, //是否是从记录点进来的
				situation_id:0,
				jindu:'',
				
				loading:false,
				loading2:false,
				is_yichangForm:false,
				is_waitHandle:false
			}
		},
		onLoad(options) {
			console.log(options)
			this.is_list = options.is_list
			this.join_order_id = options.join_order_id
			this.situation_id = options.situation_id
			if(options.jindu){
				this.jindu = options.jindu
			}
			
			this.getCooperationOrderDetail()
		},
		onReady() {
			var title_ = "异常反馈";
			if(this.lang=='ru'){
				title_ = "Спор";
			}
			uni.setNavigationBarTitle({		//自定义标题
				title: title_
			})
		},
		onShow() {
			const that = this
			that.$u.api.order.getCooperationOrderDetail({
				id: that.join_order_id,
				lang:that.lang
			}).then(res => {
				that.order=res
				that.is_yichangForm = true
				if(that.is_list==1){
					if((that.order)&&(that.order.orderInfo.situation_id==null)){
						that.is_yichangForm = true
					}else{
						that.is_yichangForm = false
						that.loading2=false
						
						that.$u.api.order.abnormalFeedbackFecord({
							join_user_id: that.order.orderInfo.join_user_id,
							order_id: that.order.orderInfo.id,
							id: that.situation_id,
							user_id: that.order.user_id,
							lang:that.lang
						}).then(result => {
							if(result){
								that.record = result
								that.is_waitHandle  = true
								that.loading2=true
								
							}
						})
						
					}
				}
			})
		},
		mounted() {
			
		},
		methods:{
			//合作订单详情
			getCooperationOrderDetail(){
				const that = this
				that.loading = false
				that.$u.api.order.getCooperationOrderDetail({
					id: that.join_order_id,
					lang:that.lang
				}).then(res => {
					that.order=res
					that.loading= true
					that.is_yichangForm = true
					
					if(that.is_list==1){
						if((that.order)&&(that.order.orderInfo.situation_id==null)){
							that.is_yichangForm = true
						}else{
							that.is_yichangForm = false
							that.loading2=false
							that.$u.api.order.abnormalFeedbackFecord({
								join_user_id: that.order.orderInfo.join_user_id,
								order_id: that.order.orderInfo.id,
								id: that.situation_id,
								user_id: that.order.user_id,
								lang:that.lang
							}).then(result => {
								if(result){
									that.record = result
									that.is_waitHandle  = true
									that.loading2=true
								}
							})
							
						}
					}
				
				})
			},
			yichang_tab(e,data){
				var that = this
				that.getCooperationOrderDetail()
			}
		}
	}
</script>

